#!/bin/bash
#
# Copyright (C) 2013-2021 Spring Studio
# Copyright (C) 2013-2021 Dou Dongchun <doudongchun@163.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

########### library variables ##########
URI=
GIT=https://gitee.com/springstudio/libopenssl.git
COMMIT=openssl-3.1.1
LOCAL=openssl

########### build library ##########

build_arch()
{
  rm -rf build
  mkdir build
  cd build

  if [ "$ARCH" = "armv7a" ]; then
    arch="android-arm"
  else
    arch="android-$ARCH"
  fi
  
  # no-unit-test no-shared with-zlib-include with-zlib-lib zlib zlib-dynamic
  ../Configure $arch no-unit-test zlib-dynamic -D__ANDROID_API__=$API \
    --prefix=$PREFIX

  make clean
  make -j4 -s
  make install_sw

  cd -
}

clear_arch() {
  if [ -d build ]; then
    cd build && make clean && cd -
    rm -rf build
  fi
}

############# forbid modify ###########

. ./tools/do-compile.sh
